<template>
  <div class="pagination-container">
    <!-- <el-pagination
      :background="background"
      :current-page.sync="page"
      :page-size.sync="pageSize"
      :layout="layout"
      :page-sizes="pageSizes"
      :total="total"
      @size-change="handleSizeChange"
      @current-change="handleCurrentChange"
    /> -->

    <el-pagination
      @size-change="handleSizeChange"
      @current-change="handleCurrentChange"
      :current-page.sync="currentPage"
      :page-size="limit"
      layout="prev, pager, next, jumper"
      :total="total"
    >
    </el-pagination>
  </div>
</template>

<script>
// import { scrollTo } from '@/utils/scroll-to'

export default {
  name: "Pagination",
  props: {
    total: {
      required: true,
      type: Number,
    },
    page: {
      type: Number,
      default: 1,
    },
    limit: {
      type: Number,
      default: 10,
    },
    pageSizes: {
      type: Number,
      default: 10,
    },
    layout: {
      type: String,
      default: "total, sizes, prev, pager, next, jumper",
    },
    background: {
      type: Boolean,
      default: true,
    },
    autoScroll: {
      type: Boolean,
      default: true,
    },
    hidden: {
      type: Boolean,
      default: false,
    },
  },
  computed: {
    currentPage: {
      get() {
        return this.page;
      },
      set(val) {
        this.$emit("update:page", val);
      },
    },
    // pageSize: {
    //   get() {
    //     return this.limit
    //   },
    //   set(val) {
    //     this.$emit('update:limit', val)
    //   }
    // }
  },
  methods: {
    handleSizeChange(val) {
      this.$emit("pagination", { page: val });
      // if (this.autoScroll) {
      //   scrollTo(0, 800)
      // }
    },
    handleCurrentChange(val) {
      this.$emit("pagination", { page: val });
      // if (this.autoScroll) {
      //   scrollTo(0, 800)
      // }
    },
  },
};
</script>

<style>
.pagination-container {
  background: transparent;
  text-align: right;
  width: 100%;
  height: 100%;
  margin-top: 0 !important ;
  color: #fff;
}
.pagination-container.hidden {
  display: none;
}

.pagination-container .el-pagination .btn-prev,
.pagination-container .el-pagination .btn-next {
  background-color: transparent;
  color: #fff;
}
.pagination-container .el-pager li {
  background-color: transparent;
  color: #fff;
}
.pagination-container .el-pagination__jump {
  color: #fff;
}

.pagination-container .el-input__inner {
  color: #fff;
}
.pagination-container .el-pager li.active {
  color: #1890ff;
}
</style>
